package strings;

public class Strings {
	public static void main(String[] args) {
		String s1 = "abc";	//create one String object and one reference variable
		String s2 = new String("abc");	//create two objects and one reference variable
		
		String x1 = "airplane";
		System.out.println(x1.charAt(2));
		
		String x2 = "taxi";
		System.out.println(x2.concat(" cab"));
		
		String x3 = "library";
		System.out.println(x3 + " card");
		
		String x4 = "Atlantic";
		x4 += " ocean";
		System.out.println(x4);
		
		String x5 = "Exit";
		System.out.println(x5.equalsIgnoreCase("EXIT"));
		System.out.println(x5.equalsIgnoreCase("tixe"));
		
		String x6 = "01234567";
		System.out.println(x6.length());
		
		String x7 = "oxoxoxox";
		System.out.println(x7.replace('x', 'X'));
		
		String x8 = "0123456789";
		System.out.println(x8.substring(5));
		System.out.println(x8.substring(5, 8));
		
		String x9 = "A New Moon";
		System.out.println(x9.toLowerCase());
		
		String x10 = "big surprise";
		System.out.println(x10.toString());
		
		String x11 = "A New Moon";
		System.out.println(x11.toUpperCase());
		
		String x12 = "     hi     ";
		System.out.println(x12 + "x");
		System.out.println(x12.trim() + "x");
		
		StringBuffer sb1 = new StringBuffer("abc");
		sb1.append("def");
		System.out.println("sb1 = " + sb1);
		
		StringBuilder sb2 = new StringBuilder("abc");
		sb2.append("def").reverse().insert(3, "---");
		System.out.println(sb2);
		
		String sb2_null = null;
		StringBuilder sb2_1 = new StringBuilder("string");
		sb2_1.insert(1, sb2_null);
		System.out.println(sb2_1);
		
		StringBuffer sb3 = new StringBuffer("set ");
		sb3.append("point");
		System.out.println(sb3);
		StringBuffer sb3_1 = new StringBuffer("pi = ");
		sb3_1.append(3.14159f);
		System.out.println(sb3_1);
		
		StringBuilder sb4 = new StringBuilder("0123456789");
		System.out.println(sb4.delete(4, 6));
		
		StringBuilder sb5 = new StringBuilder("0123456789");
		sb5.insert(4, "---");
		System.out.println(sb5);
		
		StringBuffer sb6 = new StringBuffer("A man a plan a canal Panama");
		sb6.reverse();
		System.out.println(sb6);
		
		StringBuffer sb7 = new StringBuffer("test string");
		System.out.println(sb7.toString());
		
		
		
		
		
		
	}
}
